<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/commonJS.jsp" %>
<%@ include file="../common/commonLabel.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>库存信息列表</title>
</head>
<script type="text/javascript">

function doDeltype(cid){
	if(confirm("确定删除该物料信息吗？")){
		document.all["sid"].value = cid;
		document.all["operate"].value = "delinfo";
		document.forms[0].submit();
	}
}
//查看物料信息
function doSelinfo(id){
	document.all["gid"].value = id;
	document.all["operate"].value = "selpage";
	document.forms[0].action = "<%=path %>/makings.action";
	document.forms[0].submit();
}
//进行采购信息
function doBuy(gid){
	document.forms[0].action = "<%=path %>/purchase.action?operate=inspage&parentlink=50&sonlink=86&goodsid="+gid;
	document.forms[0].submit();
}
//特殊出入库信息
function dospecial(crflag){
	doQueryMess("<%=path %>/stockspecial.action?operate=inspage&crflag="+crflag+"&mtp=${action}","","600","300");
}

//新增页面
function doIns(){
	document.forms[0].action = "<%=path %>/makings.action";
	document.all["operate"].value = "inspage";
	document.forms[0].submit();
}
//查看历史记录
function dosellog(){
	document.all["operate"].value = "sellog";
	document.forms[0].submit();
}
</script>
<body>
<form action="<%=path %>/${action}.action" method="post" >
<table width="80%" border="0" cellpadding="0" cellspacing="0" >
  <tr>
     <td>
     <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" class="MainBody">
		<tr>
    		<td width="760" class="MainBody_title"><hello:forValue type="title" /></td>
		</tr>
      <tr>
        <td valign="top" >
        <table border="0" cellspacing="0" cellpadding="0" style="margin: 5px 0 10px 20px;width:90%">
			<tr height="35">
				<td align="right" ><input name="makingtype" type="hidden" value="${action}"/>
				<input name="gid" type="hidden" value=""/>
				<input name="sid" type="hidden" value=""/>
				<input name="operate" type="hidden" value=""/></td>
				<td align="right" ><input type="button" value="查询" class="btn" onclick="doSel()"/>
				<%--&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="添加" class="btn" onclick="doIns()"/>--%>
				&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="特殊入库" class="btn" onclick="dospecial('rk')"/>
				&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="特殊出库" class="btn" onclick="dospecial('ck')"/>
				&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="历史记录" class="btn" onclick="dosellog()"/></td>
			</tr>
			<tr >
				<td colspan="2" class="box01">
				<SPAN>物料名称：<input type="text" name="goodsname" value="${goodsname}" maxlength="30"></SPAN>
				<SPAN>规格：<input type="text" name="standard" value="${standard}" maxlength="30"></SPAN>
				<SPAN>种类：<input type="text" name="goodstype" value="${goodstype}" maxlength="30"></SPAN>
				<SPAN>品牌：<input type="text" name="brand" value="${brand}" maxlength="30"></SPAN>
				</td>
			</tr>
		</table>
        <table border="0" cellpadding="0" cellspacing="0"  class="MainBody_table">
           <tr>
				<th width="10%" nowrap="nowrap">种类</th>
				<th width="16%" nowrap="nowrap">物料名称</th>
				<th width="8%" nowrap="nowrap">当前库存</th>
				<th width="8%" nowrap="nowrap">实际库存</th>
				<th width="6%" nowrap="nowrap">单位</th>
				<th width="16%" nowrap="nowrap">规格</th>
				<th width="12%" nowrap="nowrap">品牌</th>
				<th width="8%" nowrap="nowrap">预警库存</th>
				<th width="8%" nowrap="nowrap">操作</th>
			</tr>
			<c:forEach items="${listinfo}" varStatus="status" var="rows">
			<tr style="background-color: <c:if test="${rows.numreal-rows.warnnum<0}">red</c:if><c:if test="${rows.numreal-rows.warnnum==0}">yellow</c:if>;">
				<td nowrap="nowrap">${rows.goodstype}</td>
				<td nowrap="nowrap"><a href="#" title="物料详细信息" onclick="doSelinfo('${rows.sid}')">${rows.goodsname}</a></td>
				<td nowrap="nowrap">${rows.numnow}</td>
				<td nowrap="nowrap">${rows.numreal}</td>
				<td nowrap="nowrap">${rows.unit}</td>
				<td nowrap="nowrap">${rows.standard}</td>
				<td nowrap="nowrap">${rows.brand}</td>
				<td nowrap="nowrap">${rows.warnnum}</td>
				<td nowrap="nowrap">
				<c:if test="${rows.numreal-rows.warnnum<=0}"><span class='RoleSpan' onclick="doBuy('${rows.goodsid}')" title='紧急采购原材料' style='color: green;' onmouseout="doMsOut('green')" onmouseover='doMsOver()'>采购</span>&nbsp;&nbsp;</c:if>
				<span class='RoleSpan' onclick="doDeltype('${rows.sid}')" title='删除该库存信息' style='color: purple;' onmouseout="doMsOut('purple')" onmouseover='doMsOver()'>删除</span>
				</td> 
			</tr>
			</c:forEach>
		<c:if test="${empty listinfo}">
			<tr>
				<td colspan="9" align="center">暂时没有您可以浏览的数据</td>
			</tr>
		</c:if>
          </table>
          <c:if test="${!empty listinfo}">
          <table border="0" cellpadding="0" cellspacing="0" class="MainBody_fun">
            <tr>
              <td>
               <hello:AllPage />
			  </td>
            </tr>
          </table>
          </c:if>
          </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>